package com.coocaa.ops.api.base.third.rec.feign;

import com.coocaa.ops.api.base.third.FeignServiceNameConstants;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author zen
 * @date 2020-08-04 16:43
 * @description
 */
@Slf4j
@Component
public class GetRecStreamFallBackFactory implements FallbackFactory<GetRecStreamFeignClient> {
    @Override
    public GetRecStreamFeignClient create(Throwable cause) {
        GetRecStreamFeignClient getRecStreamFeignClient = (@RequestParam Map<String, String> data) -> {
            log.error(FeignServiceNameConstants.BIG_DATA_REC_CONTENT + " 出现问题: " + cause.toString() + ", 进行熔断处理!");
            return "";
        };
        return getRecStreamFeignClient;
    }
}
